package com.hmall.geteway;

import org.apache.http.HttpStatus;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.annotation.Order;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
@Order(0)
public class MyGlobalFilter implements GlobalFilter {
    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
        //拿到返回值
        //ServerHttpResponse response = exchange.getResponse();
        //System.out.println("拦截");
        //设定401
        // response.setRawStatusCode(HttpStatus.SC_NOT_FOUND);
        return null;
        //return response.setComplete();
    }

}
